<?php
if (!isset($_SESSION)) {
  session_start();
}
require_once('../Connections/mysql.php'); 
require_once('./functions/functions.php'); 
require_once('./classes/hero_class.php');
if (!isset($_SESSION['MM_UserID']))
{
	w_js('location.href="../index.php";');
}
mysql_select_db($database_mysql, $mysql);
$sqlquery="SELECT
id,username,password,type,charactor
FROM users WHERE 
id=$_SESSION[MM_UserID]";
$sql_result=mysql_query($sqlquery,$mysql);
status("正在检查你的人物。");
//判断是否已经建立人物
if (mysql_result($sql_result,0,'charactor'))
{
	status("很好，我们找到了你的人物。");
	$charactor_id=mysql_result($sql_result,0,'charactor');
	$this_hero=new hero($charactor_id);
	echo $this_hero->name;
	$_SESSION['MM_HeroID']=$this_hero->id;
	ajax_js("control","load","control.php");
	ajax_js("main","load","look");
	//接下来覆盖自己（拙劣的方法）
	ajax_js("foot","load","char_stat");
}
else
{
	status("你还没有建立人物，我们正在将你转向到人物创建页面。");
	w_js('location.href="./create_charactor";');
}

?>